﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
	protected void btnUpload_Click(object sender, EventArgs e)
	{
		string path = Server.MapPath("Images\\");
		string filename = "";
		int slashPos = -1;
		int dotPos = -1;
		string shortName = "";
		string fileType = "";

		filename = fupPic.PostedFile.FileName;
		slashPos = filename.LastIndexOf("\\");
		dotPos = filename.LastIndexOf(".");
		shortName = filename.Substring(slashPos + 1);
		fileType = filename.Substring(dotPos + 1);


		try
		{
			fupPic.PostedFile.SaveAs(path + shortName);
			Image1.ImageUrl = "Images\\" + shortName;
		}
		catch (Exception ex)
		{
			
			Response.Write(ex.Message);
		}
			
	}
}
